package com.shuqi.activity.viewport;

import com.shuqi.controller.R;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.widget.EditText;

public class PhoneEditTextView extends EditText {


    public PhoneEditTextView(Context context) {
        super(context);
    }

    public PhoneEditTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        setTextColor(0xff494949);
        setHintTextColor(0xffb9b9b9);
    }

    public PhoneEditTextView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        setTextColor(0xff494949);
        setHintTextColor(0xffb9b9b9);
    }



    public void separatedText() {
        String inputText = this.getText().toString();
        if (!TextUtils.isEmpty(inputText) && inputText.length() == 11) {
            StringBuilder resultStr = new StringBuilder();
            resultStr.append(inputText.substring(0, 3)).append("-")
                    .append(inputText.substring(3, 7)).append("-").append(inputText.substring(7));
        }
    }

    public String getString() {
        return this.getText().toString().replace("-", "");
    }

}
